package br.com.nuccitec.jfera.basic;

import br.com.nuccitec.jfera.api.IRemoteResponse;
import br.com.nuccitec.jfera.business.AbstractBusinessExecutor;
import br.com.nuccitec.jfera.business.BusinessResponse;
import br.com.nuccitec.jfera.business.IBusinessPrefixExecutor;
import br.com.nuccitec.jfera.validation.vo.AbstractVO;

public class GenericUpdateExecutor extends AbstractBusinessExecutor implements IBusinessPrefixExecutor {
	static public final String UPDATE_PREFIX = "UPDATE";

	@Override
	public String requestPrefixToAttend() {
		return UPDATE_PREFIX;
	}

	@Override
	public IRemoteResponse execute(Object objVO) {
		AbstractVO a = (AbstractVO) objVO;
		getColaborator().logInfo(getClass(), "Updating " + a);
		a.setColaborator(getColaborator());
		a.updateOnDB();
		return new BusinessResponse(a);
	}
}
